﻿package 
{
    import flash.display.*;
    import flash.net.*;
    import morn.core.components.*;
    import morn.core.handlers.*;
    import morn.core.managers.*;

    public class App extends Object
    {
        public static var stage:Stage;
        public static var asset:AssetManager = new AssetManager();
        public static var loader:LoaderManager = new LoaderManager();
        public static var timer:TimerManager = new TimerManager();
        public static var render:RenderManager = new RenderManager();
        public static var dialog:DialogManager = new DialogManager();
        public static var drag:DragManager = new DragManager();
        public static var lang:LangManager = new LangManager();
        public static var maploader:MassLoaderManager = new MassLoaderManager();
        public static var mloader:MassLoaderManager = new MassLoaderManager(true);
        public static var mloader2:MassLoaderManager = new MassLoaderManager(false);
        public static var mloader3:MassLoaderManager = new MassLoaderManager(false);
        public static var leisureMloader:MassLoaderManager = new MassLoaderManager(false, true);
        public static var localLoader:MassLoaderManager = new MassLoaderManager(false, false, true);
        public static var skinManager:SkinManager = new SkinManager();
        public static var CurPluginName:String = null;
        public static var renderItemFactory:RenderItemFactory = new RenderItemFactory();

        public function App()
        {
            return;
        }// end function

        public static function init(param1:Sprite) : void
        {
            var _loc_3:String = null;
            stage = param1.stage;
            var _loc_2:* = stage.loaderInfo.parameters;
            if (_loc_2 != null)
            {
                for (_loc_3 in _loc_2)
                {
                    
                    if (MornConfig[_loc_3] != null)
                    {
                        MornConfig[_loc_3] = _loc_2[_loc_3];
                    }
                }
            }
            stage.addChild(dialog);
            if (Boolean(MornConfig.uiPath))
            {
                App.loader.loadDB(MornConfig.uiPath, new Handler(onUIloadComplete));
            }
            return;
        }// end function

        private static function onUIloadComplete(param1) : void
        {
            View.xmlMap = param1;
            return;
        }// end function

        public static function getResPath(param1:String) : String
        {
            return /^http:\/\/""^http:\/\//g.test(param1) ? (param1) : (MornConfig.resPath + param1);
        }// end function

        public static function gc() : void
        {
            var conn1:LocalConnection;
            var conn2:LocalConnection;
            try
            {
                conn1 = new LocalConnection();
                conn1.connect("sban garbage collection 1");
                conn2 = new LocalConnection();
                conn2.connect("sban garbage collection 1");
            }
            catch (error:Error)
            {
            }
            finally
            {
                conn1;
                conn2;
            }
            return;
        }// end function

    }
}
